import type { ApiResponse } from '@/types/basetypes';
import type { CustomerFrom } from '@/types/customer/types';
import type { UpdateWrapper } from '@/types/wrapper';
import request from '@/utils/request'

//查询客户列表信息
export function _getCustomerList(params : object) {
  return request({
    url: '/crm-customer/query-all',
    method: 'GET',
    params: params,
  });
}
//查询客户信息
export const _getCustomerInfo = async (params: { id: string }): Promise<ApiResponse<CustomerFrom>> => {
  const { id } = params;
  return request({
    url: `/crm-customer/query-details/${id}`,
    method: 'GET',
  });
}

  //保存客户信息
export const _saveCustomerInfo = async (params : object) : Promise<ApiResponse<void>> => {
    return request({
      url: '/crm-customer/insert',
      method: 'POST',
      data: params,
    });
  }

  //更新客户信息
export const _modifyCustomerInfo = async (params : UpdateWrapper): Promise<ApiResponse<void>>=> {
    return request({
      url: '/crm-customer/modify',
      method: 'POST',
      data: params,
    });
  }
  //更新客户信息
  export const _delCustomerInfoByIds = async (ids : string): Promise<ApiResponse<void>>=> {
    return request({
      url: '/crm-customer/del-ids',
      method: 'POST',
      data: {ids:ids},
    });
  }

